package com.saasitems.admin.web.controller;

import com.saasitems.admin.model.Product;
import com.saasitems.admin.service.OrderInfoService;
import com.saasitems.admin.service.ProductService;
import com.saasitems.admin.web.vo.orderinfo.OrderInfoQueryVO;
import com.saasitems.admin.web.vo.orderinfo.OrderInfoVO;
import com.saasitems.admin.web.vo.product.ProductQueryVO;
import com.saasitems.admin.web.vo.product.ProductVO;
import com.saasitems.admin.web.vo.product.UpFiles;
import com.saasitems.common.model.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2016/12/15.
 */
@Controller
public class OrderInfoController extends BaseController {

    @Autowired
    private OrderInfoService orderInfoService;

    @RequestMapping(value="admin/orderinfo/index",method= RequestMethod.GET)
    public ModelAndView index() {
        PageInfo page = new PageInfo(1, 1);
        List<OrderInfoVO> list = orderInfoService.query(null, page);
        Map<String, Object> model = new HashMap<String, Object>();
        model.put("info", list);
        model.put("queryvo", new OrderInfoQueryVO());
        model.put("page", page);
        return new ModelAndView("admin/orderinfo/index", model);
    }

    @RequestMapping(value="admin/orderinfo/index",method= RequestMethod.POST)
    public ModelAndView index(OrderInfoQueryVO queryVO, PageInfo page) {
        List<OrderInfoVO> list = orderInfoService.query(queryVO, page);
        Map<String, Object> model = new HashMap<String, Object>();
        model.put("info", list);
        model.put("queryvo", queryVO);
        model.put("page", page);
        return new ModelAndView("admin/orderinfo/index", model);
    }
}
